# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator


jms_dm__dm_network_bagging_detail_send_dt = SparkSubmitOperator(
    task_id='jms_dm__dm_network_bagging_detail_send_dt',
    email=['guoruiling@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_network_bagging_detail_send_dt_{{ execution_date | date_add(1) | cst_ds }}',
    pool_slots=4,
    retries=0,
    driver_memory='4G',
    executor_memory='8G',
    executor_cores=4,
    num_executors=50,
    yarn_queue='pro',
    conf={'spark.dynamicAllocation.enabled': 'false',  # 动态资源开启
          'spark.shuffle.service.enabled': 'false',  # 动态资源 Shuffle 服务开启
          'spark.dynamicAllocation.maxExecutors': 50,  # 动态资源最大扩容 Executor 数
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,  # 动态资源自动释放闲置 Executor 的超时时间(s)
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
          'spark.executor.memoryOverhead': '4G',  # 堆外内存
          'spark.default.parallelism': 600,
          'spark.sql.shuffle.partitions': 600,
          'spark.executor.extraJavaOptions': '-XX:+UseG1GC -XX:ParallelGCThreads=4 -XX:ConcGCThreads=2'
          },
    jars='hdfs:///scheduler/jms/spark/grl/dm_network_bagging_detail_send_dt/common-1.0-SNAPSHOT.jar',  # 依赖 jar 包
    java_class='com.yunlu.bigdata.jobs.test.ExportNetworkBaggingSend',  # spark 主类
    application='hdfs:///tmp/grl/dm_network_bagging_detail_send_dt/original-jobs-1.0-SNAPSHOT.jar',
    # spark jar 包
    application_args=['{{ execution_date | cst_ds }}'],
    #execution_timeout=timedelta(hours=3)
    #excel平均时长:17分14秒
    #execution_timeout = timedelta(minutes=60)
    #excel平均时长:17分14秒
    execution_timeout = timedelta(minutes=60)

)

jms_dm__dm_network_bagging_detail_send_dt  << [
]
 